<template>
    <div class="menu-wrapper">
        <template v-for="item in menuTree">
            <el-submenu v-if="item.children.length != 0"
                        :key="item.menuId"
                        :index="item.menuName">
                <template slot="title">
                    <i :class="item.icon"></i>
                    <span slot="title" :class="{'el-menu--display':collapse}"> {{item.menuName}}</span>
                </template>
                <sidebar-item :menuTree="item.children" :collapse="collapse"/>
            </el-submenu>
            <el-menu-item v-if="item.children.length == 0"
                          :key="item.menuId"
                          :index="item.url">
                <i :class="item.icon"></i>
                <span slot="title">{{item.menuName}}</span>
            </el-menu-item>
        </template>
    </div>
</template>

<script>
export default {
  name: "sidebarItem",
  props: ["menuTree", "collapse"]
};
</script>

<style scoped>
.el-submenu__icon-arrow {
  display: none;
}
</style>
